package com.ask.common.enumeration;

import static com.ask.common.constant.ExceptionMessageConstant.STATUS_CODE_ERROE;

public enum ActivityStatus {
    DRAFT(1),      // 草稿状态
    PUBLISHED(2),  // 已发布状态
    ONGOING(3),    // 进行中
    COMPLETED(4),  // 已完成
    CANCELLED(5);  // 已取消状态

    private final int code;

    ActivityStatus(int code) {
        this.code = code;
    }

    public static ActivityStatus fromCode(int statusCode) {
        for (ActivityStatus status : ActivityStatus.values()) {
            if(status.code == statusCode)
                return status;
        }
        throw new IllegalArgumentException(STATUS_CODE_ERROE);
    }
}
